const { type } = require('os');
var mongoose = require('../db_con')
//用户表
var Userschema = mongoose.Schema({
    person_id: {
        type: String,
        required: [true, '请输入您的学号或教工号'],
        unique: true,
        dropDups: true
    },//学号或教工号，主键
    password: {
        type: String,
        required: [true, '请输入密码']
    },//密码
    class_id: {
        type: String
    },//班号
    name:  {
        type: String,
        require: true
    },
    sex:  {
        type: String,
        require: true,
        enum: ["0", "1"]//性别，0-男性，1-女性
    },
    birthday: {
        type: String,
        required: true
    },
    identity: {
        type: String,
        require: true,
        default: '0',//身份,1-老师,0-学生
        enum: ["0", "1"]
    },
})

const UserModel = mongoose.model('User', Userschema, 'users')

module.exports = UserModel;//暴露模块